import request from '../utils/request'
let token = localStorage.token
let service = {
    getAllUser(param){
        console.log(param);
        return request({
            method:'GET',
            url:`/user`,
            headers:{
                Authentication:token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
            params:{
                pageSize:param.pageSize,
                username:param.username,
                deptId:param.deptId,
                ssex:param.ssex,
                status:param.status,
                createTimeFrom:param.createTimeFrom,
                createTimeTo:param.createTimeTo
            }
        })
    },
    delUser(userId){
        return request({
            method:'delete',
            url:`/user/${userId}`,
            headers:{
                Authentication:token,
                'Content-Type':'application/x-www-form-urlencoded'
            }
        })
    },
    addUser(param){
        return request({
            method:'POST',
            url:'/user',
            headers:{
                Authentication:token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
            data:param
        })
    },
    editUser(param){
        console.log(param);
        return request({
            method:'PUT',
            url:'/user',
            headers:{
                Authentication:token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
            data:param
        })
    },
    resetPassword(param){
        console.log(param);
        return request({
            method:'PUT',
            url:'/user/password/reset',
            headers:{
                Authentication:token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
            data:param
        })
    },
    excel(){
        return request({
            method:'POST',
            url:'/user/excel',
            headers:{
                Authentication:token,
                'Content-Type':'application/x-www-form-urlencoded'
            },
        })
    }
}

export default service